/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package apt;

import javax.swing.AbstractListModel;

/**
 *
 * @author PhiNguyen
 */
public class ComboBoxModel extends AbstractListModel implements javax.swing.ComboBoxModel {
    int[] data;
    int selection;

    public ComboBoxModel(int[] data) {
        this.data = data;
    }
    
    @Override
    public int getSize() {
        return data.length;
    }

    @Override
    public Object getElementAt(int index) {
        return data[index];
    }

    @Override
    public void setSelectedItem(Object anItem) {
        selection = (Integer) anItem;
    }
    
    

    @Override
    public Object getSelectedItem() {
        return selection;
    }
    
}
